{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6d559e01",
   "metadata": {},
   "source": [
    "---\n",
    "* 2023-11-1\n",
    "* 课程：Python语言\n",
    "* week07\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7f3e13d",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "## 1. 列表的概念\n",
    "## 2. 列表的性质\n",
    "## 3. 列表的一般方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3476bd10",
   "metadata": {},
   "source": [
    "# 1. 列表的概念\n",
    "* 思考：如果我们想要存放一个班级的同学名字，目前我们有什么方法？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a177e498",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "小明 张三 小红 李晓明\n"
     ]
    }
   ],
   "source": [
    "# 第一种方法\n",
    "\n",
    "name01 = \"小明\"\n",
    "name02 = \"张三\"\n",
    "name03 = \"小红\"\n",
    "name04 = \"李晓明\"\n",
    "print(name01,name02,name03,name04)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "76757d64",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "小明 张三 小红 李晓明\n"
     ]
    }
   ],
   "source": [
    "# 第二种方法\n",
    "name = \"小明 张三 小红 李晓明\"\n",
    "print(name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f61fa3af",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'小红'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 尝试取值：小红\n",
    "name[6:8]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e75080a",
   "metadata": {},
   "source": [
    "* 综上所述，列表就诞生了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "1e98a234",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['小明', '张三', '小红', '李晓明']\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"小明\",\"张三\",\"小红\",\"李晓明\"]\n",
    "print(name_list)\n",
    "print(type(name_list))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "19d2c196",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'小红'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[2]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ebe67925",
   "metadata": {},
   "source": [
    "# 2. 列表的性质"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "15afd72c",
   "metadata": {},
   "source": [
    "## 2.1 列表的有序性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "29a78d12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'小明'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b913421d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'张三'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b617421a",
   "metadata": {},
   "source": [
    "## 2.2 列表的可变性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "dc92e387",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', '小红', '李晓明']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "96025ce8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', '小红', '李树人']"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[3] = \"李树人\"\n",
    "name_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85154f0b",
   "metadata": {},
   "source": [
    "## 2.3 列表存放不同的数据结构的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "8474220e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', 18, '张三', 19, '小红', 18, '李树人', 20]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_age_list = ['小明',18,'张三',19,'小红',18,'李树人',20]\n",
    "name_age_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fbdd6d77",
   "metadata": {},
   "source": [
    "## 2.4 列表重复性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "197ae38f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[95, 90, 95, 92, 88, 90, 93, 95]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python = [95,90,95,92,88,90,93,95]\n",
    "网新_python"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a4b2a527",
   "metadata": {},
   "source": [
    "# 3. 列表的方法\n",
    "\n",
    "> 1. 列表的创建\n",
    ">> 1. 直接用[]创建列表，中间元素用英文的,隔开\n",
    ">> 2. 使用list()创建列表\n",
    "> 2. 列表的处理\n",
    ">> 1. 取值\n",
    ">> 2. 查询\n",
    ">> 3. 增加\n",
    ">> 4. 删除"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "56cfb27f",
   "metadata": {},
   "source": [
    "## 3.1 列表的创建"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "f5672ce6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 使用list()列表构造器创建列表\n",
    "my_list = list((1,2,3))\n",
    "my_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3dc65897",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "my_list2 = [1,2,3]\n",
    "print(my_list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3ab72d4d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建空列表\n",
    "my_list3 = list()\n",
    "my_list3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "88c30ebe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_list4 = []\n",
    "my_list4"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95ddc14c",
   "metadata": {},
   "source": [
    "## 3.2 列表的方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5371eaa0",
   "metadata": {},
   "source": [
    "### 1. 列表的取值\n",
    "\n",
    "> 1. index 取单个值\n",
    "> 2. 切片 截取多个值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "fd18efc2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['小明', '张三', '小红', '李晓明']\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"小明\",\"张三\",\"小红\",\"李晓明\"]\n",
    "print(name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "bb3447dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'张三'"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取出 张三 同学的名字\n",
    "name_list[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "eb550794",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小红', '李晓明']"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 通过切片取出后两位同学\n",
    "name_list[-2:]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ac71d3b4",
   "metadata": {},
   "source": [
    "### 2.列表的查询\n",
    "\n",
    "* in 方法作为python的一个特殊方法，不仅可以在列表数据使用，其他数据也可以\n",
    "* len() 对数据长度（范围）进行查询"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "272c4e9d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"小红\" in name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "93935c1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"小鹏\" in name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "bf407165",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(name_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "81f6d804",
   "metadata": {},
   "source": [
    "### 3. 关于列表的新增"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "ec8af127",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['小明', '张三', '小红', '李晓明']\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"小明\",\"张三\",\"小红\",\"李晓明\"]\n",
    "print(name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "7da81d1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', '小红', '李晓明', 'Dainel']"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list.append(\"Dainel\")\n",
    "name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "1a665c17",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function append:\n",
      "\n",
      "append(object, /) method of builtins.list instance\n",
      "    Append object to the end of the list.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(name_list.append)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "43519a05",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function insert:\n",
      "\n",
      "insert(index, object, /) method of builtins.list instance\n",
      "    Insert object before index.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# insert\n",
    "help(name_list.insert)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "d88afcfe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', 'Marry', '小红', '李晓明', 'Dainel']"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list.insert(2,\"Marry\")\n",
    "name_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1028c8a0",
   "metadata": {},
   "source": [
    "* 临时讲一个方法：count()统计某个元素在列表中出现的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "168f5201",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[95, 90, 95, 92, 88, 90, 93, 95]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python = [95,90,95,92,88,90,93,95]\n",
    "网新_python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "14a3dfc7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python.count(95)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a3c1bf3",
   "metadata": {},
   "source": [
    "* 综合实践：\n",
    "* 投骰子1000次，分别统计每一个骰子面出现的次数\n",
    "> 1. 创建一个空列表\n",
    "> 2. 通过append方法将每一次产生的骰子数存进去\n",
    "> 3. 通过count方法查询每一骰子面的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "4dad7a46",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1000\n",
      "[4, 4, 3, 4, 3, 5, 2, 6, 6, 4, 1, 1, 3, 5, 5, 1, 4, 5, 3, 5, 3, 6, 6, 5, 4, 6, 4, 3, 1, 5, 6, 2, 5, 3, 4, 2, 6, 3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 6, 5, 5, 4, 5, 2, 2, 6, 3, 4, 2, 4, 5, 3, 5, 6, 5, 2, 2, 4, 1, 1, 6, 4, 2, 4, 4, 5, 3, 1, 3, 3, 6, 5, 4, 2, 1, 4, 5, 4, 1, 5, 5, 2, 6, 4, 2, 1, 6, 5, 1, 4, 5, 3, 5, 1, 2, 2, 5, 5, 6, 1, 4, 2, 2, 3, 2, 5, 2, 3, 3, 4, 4, 1, 6, 6, 1, 4, 5, 5, 1, 2, 2, 3, 1, 3, 1, 3, 1, 5, 5, 2, 1, 5, 3, 4, 3, 3, 1, 1, 4, 5, 3, 1, 4, 4, 4, 6, 5, 2, 3, 5, 4, 6, 1, 2, 5, 2, 3, 4, 2, 6, 4, 4, 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 1, 4, 3, 1, 3, 4, 4, 2, 1, 1, 2, 2, 2, 5, 3, 1, 1, 6, 1, 5, 6, 2, 4, 4, 1, 4, 5, 4, 1, 1, 6, 6, 5, 4, 3, 2, 1, 3, 6, 6, 6, 4, 4, 4, 4, 4, 3, 6, 6, 2, 2, 4, 1, 1, 3, 5, 1, 2, 1, 6, 2, 1, 5, 6, 5, 6, 1, 3, 5, 5, 2, 6, 1, 4, 2, 6, 6, 2, 4, 5, 1, 2, 3, 1, 3, 3, 6, 1, 2, 4, 1, 2, 2, 2, 3, 5, 6, 3, 1, 6, 3, 5, 2, 1, 1, 1, 4, 1, 5, 5, 1, 2, 3, 4, 2, 5, 3, 5, 6, 3, 4, 6, 6, 3, 5, 4, 2, 4, 5, 3, 1, 1, 5, 2, 5, 6, 2, 5, 6, 3, 1, 5, 4, 4, 5, 6]\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "骰子出现的数值列表 = []\n",
    "for i in range(1000):\n",
    "    骰子出现的数值列表.append(random.randint(1,6))\n",
    "    #print(random.randint(1,6))\n",
    "print(len(骰子出现的数值列表)) # 看下列表的长度\n",
    "print(骰子出现的数值列表)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "7402e243",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 183\n",
      "2 151\n",
      "3 162\n",
      "4 172\n",
      "5 173\n",
      "6 159\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,7):\n",
    "    print(i,骰子出现的数值列表.count(i))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "b895306e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function count:\n",
      "\n",
      "count(value, /) method of builtins.list instance\n",
      "    Return number of occurrences of value.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(骰子出现的数值列表.count)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bfa5edea",
   "metadata": {},
   "source": [
    "# 课后作业：\n",
    "## 总结列表的方法\n",
    "\n",
    "|方法名称|使用说明|注意事项|案例|\n",
    "|:------:|:------:|:------:|:------:|\n",
    "|append（）方法|在列表的末尾新增元素|可以新建空列表，然后通过新增数据的方式创建数据列表|name_list.append(\"Dainel\")|\n",
    "|insert()方法|insert(index,object,/)method of builtins.list instance Insert object before index.|before index|name_list.inset(2,\"Marry\")|\n",
    "|count()|count(value,/)method of builtins.list instance Return number of occurrences of value.|如果value不存在？|骰子出现的数值列表.count(1)|"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "72ca95ab",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
